< previous page page_432 next page >

Page 432
Notice some error-checking code in the GraphType property Let method. This checks for a valid graph type and reports an error if a valid value is not found.
Now add the code from Listing 11.15 to the Class_Initialize event. This sets the default values for the properties.
Type.gifListing 11.15. Coding the Class_Initialize event.
Private Sub Class_Initialize()
    '
    ' set startup values
    '
    strDBName = ""
    strSQLSelect = ""
    strFieldPoint = ""
    strTitle = "Data Graph"
    intGraphType = gphBar3D
    '
End Sub
Now you're ready to code the ShowGraph method. This one method collects all the property values, creates a dataset, and builds a graph based on the data. Create a Public Sub called ShowGraph in the class and add the code from Listing 11.16.
Type.gifListing 11.16. Coding the ShowGraph method.
Public Sub ShowGraph()
    '
    ' display graph
    '
    On Error GoTo LocalErr
    '
    Screen.MousePointer = vbHourglass
    OpenDB
    InitGraph
    LoadGraphData
    Screen.MousePointer = vbNormal
    '
    frmGraph.Graph1.DrawMode = gphDraw
    frmGraph.Show vbModal
    '
    Exit Sub
    '
LocalErr:
    Err.Raise vbObjectError + 4, App.EXEName, "Error displaying graph"
    '
End Sub

 
< previous page page_432 next page >

If you like this book, buy it!